<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

if ( ! function_exists('get_prod_prices'))
{
	function get_prod_prices($prodId = 0,$currency = 0){
		$CI =& get_instance();

		$CI->load->model('product_model');
		
		$prod_prices = $CI->product_model->getAll(array('field' => 'MIN(IF(special_price > 0, special_price, price )) as min_price, MAX(IF(special_price > 0, special_price, price )) as max_price, promotion_value, products.id', 'parent_id' => $prodId))->result();
		
		$exchange = new Exchange();
	    return $exchange->transformPrice(($prod_prices[0]->min_price),$currency,true,$prod_prices[0]->id, false, false, $prod_prices[0]->promotion_value) . ' - ' . $exchange->transformPrice($prod_prices[0]->max_price,$currency,true,$prod_prices[0]->id) . ' ' . $currency;
	}
}